home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / regicon / reginf5.frm < prev    next >
Text File  |  1997-12-11  |  9KB  |  260 lines

  1. VERSION 5.00
  2. Object = "{6B1BE80A-567F-11D1-B652-0060976C699F}#1.0#0"; "Regicon.ocx"
  3. Begin VB.Form Form1 
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "Regicon Browser Settings"
  6.    ClientHeight    =   1935
  7.    ClientLeft      =   1500
  8.    ClientTop       =   3585
  9.    ClientWidth     =   8895
  10.    Icon            =   "reginf5.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    PaletteMode     =   1  'UseZOrder
  14.    ScaleHeight     =   1935
  15.    ScaleWidth      =   8895
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.CommandButton cmdSteps 
  18.       Caption         =   "&See the Code"
  19.       Height          =   375
  20.       Left            =   7320
  21.       TabIndex        =   2
  22.       Top             =   600
  23.       Width           =   1455
  24.    End
  25.    Begin VB.CommandButton cmdClose 
  26.       Caption         =   "&Close"
  27.       Height          =   375
  28.       Left            =   7320
  29.       TabIndex        =   1
  30.       Top             =   240
  31.       Width           =   1455
  32.    End
  33.    Begin VB.Frame Frame1 
  34.       Height          =   1695
  35.       Left            =   120
  36.       TabIndex        =   0
  37.       Top             =   120
  38.       Width           =   6975
  39.       Begin VB.CommandButton cmdReset 
  40.          Caption         =   "&Reset Start Page"
  41.          Height          =   375
  42.          Left            =   5160
  43.          TabIndex        =   10
  44.          Top             =   1200
  45.          Width           =   1695
  46.       End
  47.       Begin VB.CommandButton cmdApply 
  48.          Caption         =   "&Change Start Page"
  49.          Height          =   375
  50.          Left            =   5160
  51.          TabIndex        =   9
  52.          Top             =   840
  53.          Width           =   1695
  54.       End
  55.       Begin VB.ComboBox cboStartPages 
  56.          Height          =   315
  57.          Left            =   1680
  58.          TabIndex        =   3
  59.          Top             =   840
  60.          Width           =   3375
  61.       End
  62.       Begin RegistryControl.RegiCon RegiCon1 
  63.          Left            =   120
  64.          Top             =   840
  65.          _ExtentX        =   847
  66.          _ExtentY        =   847
  67.       End
  68.       Begin VB.Label lblDefaultBrowser 
  69.          Height          =   255
  70.          Left            =   1680
  71.          TabIndex        =   8
  72.          Top             =   240
  73.          Width           =   3375
  74.       End
  75.       Begin VB.Label Label2 
  76.          Alignment       =   1  'Right Justify
  77.          Caption         =   "Deafult Browser:"
  78.          Height          =   255
  79.          Left            =   120
  80.          TabIndex        =   7
  81.          Top             =   240
  82.          Width           =   1455
  83.       End
  84.       Begin VB.Label Label3 
  85.          Alignment       =   1  'Right Justify
  86.          Caption         =   "Current Start Page:"
  87.          Height          =   255
  88.          Left            =   120
  89.          TabIndex        =   6
  90.          Top             =   480
  91.          Width           =   1455
  92.       End
  93.       Begin VB.Label lblStartPage 
  94.          Height          =   255
  95.          Left            =   1680
  96.          TabIndex        =   5
  97.          Top             =   480
  98.          Width           =   3375
  99.       End
  100.       Begin VB.Label Label1 
  101.          Alignment       =   1  'Right Justify
  102.          Caption         =   "Start Pages:"
  103.          Height          =   255
  104.          Left            =   600
  105.          TabIndex        =   4
  106.          Top             =   840
  107.          Width           =   975
  108.       End
  109.    End
  110. End
  111. Attribute VB_Name = "Form1"
  112. Attribute VB_GlobalNameSpace = False
  113. Attribute VB_Creatable = False
  114. Attribute VB_PredeclaredId = True
  115. Attribute VB_Exposed = False
  116. Private DefaultBrowser As String
  117. Private DefaultStartPage As String
  118. Private NewStartPage As String
  119. Private fDirty As Boolean
  120.  
  121. Private Sub cmdApply_Click()
  122.     Dim i As Integer
  123.     Dim fMatch As Boolean
  124.     
  125.     If MsgBox("Change start page from " & vbCrLf & NewStartPage & vbCrLf & "to" & vbCrLf & cboStartPages.Text & "?", vbQuestion + vbYesNo, "Confirm Change?") = vbNo Then
  126.         Exit Sub
  127.     End If
  128.     NewStartPage = cboStartPages.Text
  129.     fDirty = True
  130.     If InStr(1, lblDefaultBrowser.Caption, "IExplore", 1) > 0 Then
  131.         'IE
  132.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  133.         RegiCon1.Key = "Software\Microsoft\Internet Explorer\Main"
  134.         RegiCon1.KeyItemName = "Start Page"
  135.         RegiCon1.KeyItemType = dtREG_SZ
  136.         RegiCon1.KeyItemValue = NewStartPage
  137.         RegiCon1.SetEntry
  138.     ElseIf InStr(1, lblDefaultBrowser.Caption, "Netscape", 1) > 0 Then
  139.         'Netscape
  140.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  141.         RegiCon1.Key = "Software\Netscape\Netscape Navigator\Main"
  142.         RegiCon1.KeyItemName = "Home Page"
  143.         RegiCon1.KeyItemType = dtREG_SZ
  144.         RegiCon1.KeyItemValue = NewStartPage
  145.         RegiCon1.SetEntry
  146.     End If
  147.     lblStartPage.Caption = NewStartPage
  148.     For i = 0 To cboStartPages.ListCount - 1
  149.         If StrComp(NewStartPage, cboStartPages.List(i), 1) = 0 Then
  150.             fMatch = True
  151.             Exit For
  152.         End If
  153.     Next i
  154.     If fMatch = False Then
  155.         cboStartPages.AddItem NewStartPage, 0
  156.     End If
  157. End Sub
  158.  
  159. Private Sub cmdClose_Click()
  160.     Unload Me
  161. End Sub
  162.  
  163. Private Sub cmdReset_Click()
  164.     If InStr(1, lblDefaultBrowser.Caption, "IExplore", 1) > 0 Then
  165.         'IE
  166.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  167.         RegiCon1.Key = "Software\Microsoft\Internet Explorer\Main"
  168.         RegiCon1.KeyItemName = "Start Page"
  169.         RegiCon1.KeyItemType = dtREG_SZ
  170.         RegiCon1.KeyItemValue = DefaultStartPage
  171.         RegiCon1.SetEntry
  172.     ElseIf InStr(1, lblDefaultBrowser.Caption, "Netscape", 1) > 0 Then
  173.         'Netscape
  174.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  175.         RegiCon1.Key = "Software\Netscape\Netscape Navigator\Main"
  176.         RegiCon1.KeyItemName = "Home Page"
  177.         RegiCon1.KeyItemType = dtREG_SZ
  178.         RegiCon1.KeyItemValue = DefaultStartPage
  179.         RegiCon1.SetEntry
  180.     End If
  181.     lblStartPage.Caption = DefaultStartPage
  182.     cboStartPages.ListIndex = 0
  183.     NewStartPage = DefaultStartPage
  184.     fDirty = False
  185. End Sub
  186.  
  187.  
  188.  
  189. Private Sub cmdSteps_Click()
  190.     frmCode.Show 1
  191. End Sub
  192.  
  193. Private Sub Form_Load()
  194.  
  195.     'verify there is a default browser entry
  196.     RegiCon1.RootKey = rkHKEY_LOCAL_MACHINE
  197.     RegiCon1.Key = "SOFTWARE\Classes\http\shell\open\ddeexec\Application"
  198.     RegiCon1.KeyItemName = ""
  199.     
  200.     If RegiCon1.IsEntry = False Then
  201.         '
  202.         'no default browser installed, disable change start page options
  203.         cboStartPages.Enabled = False
  204.         cmdApply.Enabled = False
  205.         cmdReset.Enabled = False
  206.         Exit Sub
  207.     End If
  208.     'get the default browser
  209.     RegiCon1.GetEntry
  210.     '
  211.     'Display the entry
  212.     lblDefaultBrowser.Caption = RegiCon1.KeyItemValue
  213.     
  214.     If InStr(1, lblDefaultBrowser.Caption, "IExplore", 1) > 0 Then
  215.         'Default is Internet Explorer
  216.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  217.         RegiCon1.Key = "Software\Microsoft\Internet Explorer\Main"
  218.         RegiCon1.KeyItemName = "Start Page"
  219.         RegiCon1.GetEntry
  220.         DefaultStartPage = RegiCon1.KeyItemValue
  221.     ElseIf InStr(1, lblDefaultBrowser.Caption, "Netscape", 1) > 0 Then
  222.         'Default is Netscape
  223.         RegiCon1.RootKey = rkHKEY_CURRENT_USER
  224.         RegiCon1.Key = "Software\Netscape\Netscape Navigator\Main"
  225.         RegiCon1.KeyItemName = "Home Page"
  226.         RegiCon1.GetEntry
  227.         DefaultStartPage = RegiCon1.KeyItemValue
  228.     Else
  229.         'unknown default browser, disable change start page options
  230.         cboStartPages.Enabled = False
  231.         cmdApply.Enabled = False
  232.         cmdReset.Enabled = False
  233.         Exit Sub
  234.     End If
  235.     '
  236.     'load the StartPage box with a list of URLs
  237.     NewStartPage = DefaultStartPage
  238.     lblStartPage.Caption = NewStartPage
  239.     cboStartPages.AddItem NewStartPage
  240.     cboStartPages.AddItem "http://www.mabry.com/index.htm"
  241.     cboStartPages.AddItem "http://www.microsoft.com/index.htm"
  242.     cboStartPages.AddItem "http://www.netscape.com/index.html"
  243.     c